package com.hopu.blb_erp.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hopu.blb_erp.entity.MoveWarehouse;
import com.hopu.blb_erp.entity.Order;
import com.hopu.blb_erp.entity.PageEntity;
import com.hopu.blb_erp.mapper.MoveWarehouseMapper;
import com.hopu.blb_erp.mapper.OrderMapper;
import com.hopu.blb_erp.service.MoveWarehouseService;
import com.hopu.blb_erp.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MoveWarehouseServiceImpl extends ServiceImpl<MoveWarehouseMapper, MoveWarehouse> implements MoveWarehouseService {

    @Autowired
    private MoveWarehouseMapper moveWarehouseMapper;

    @Override
    public Integer findCount() {
        return moveWarehouseMapper.selectCount();
    }

    @Override
    public PageEntity<MoveWarehouse> findPage(Integer current, Integer pageSize) {
        Integer count = moveWarehouseMapper.selectCount();
        List<MoveWarehouse> orders = moveWarehouseMapper.selectPage((current - 1) * pageSize, pageSize);
        PageEntity<MoveWarehouse> moveWarehousePageEntity = new PageEntity<>();
        moveWarehousePageEntity.setData(orders);
        moveWarehousePageEntity.setCurrent(current);
        moveWarehousePageEntity.setCount(count);
        return moveWarehousePageEntity;
    }
}
